<html>
<head>
	<meta charset='utf-8' />
	<title>小区信息助手</title>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
	<style>
		
		@media screen and (max-width:450px){
			#content{width:98%;margin:0 auto;border:1px solid}
			/*页面宽度900以下时 .abc的宽度为450*/
		}
		@media screen and (min-width:450px){
			#content{width:450px;margin:0 auto;border:1px solid}
			/*页面宽度900以下时 .abc的宽度为450*/
		}
	</style>
</head>
<body id='content'>
	<div style='padding-bottom:50px' id='main' class='l1'>

		<div style='text-align:left;margin:5px;font-size:12px'>
			<a href="index.html" style='text-decoration:none'>首页</a>
			<div style='float:right'>
				<a style='text-decoration:none' href="index_createArea.html">创建小区</a>
			</div>
		</div>

		<h2 style='text-align:center'>我的小区</h2>

		<div style='text-align:center;font-size:12px;margin:20px 0'>当前城市：<span id='current_county'></span></div>


		<div style='border:0px solid;text-align:center' id='area_list'>
			<div style='display:flex'>
				<div style='flex:2'>金达菜小区<span style='position:absolute;width:5px;height:5px;background:red;border-radius:25px'></span></div>
				<div style='flex:1'><span style='font:normal normal 12px/30px normal'>正常</span></div>
			</div>
		</div>

	</div>



</body>
</html>
<script src='../public/jquery.js'></script>
<script src='../public/fun.js'></script>
<script>
var city_info;
var user_info;
$(function(){
	if(localStorage.beforeUserInfo){
		user_info = JSON.parse(localStorage.beforeUserInfo);
	}
	if(localStorage.current_county){
		city_info = JSON.parse(localStorage.current_county);
	}else{
		location.replace('index.html');
	}
	$('#current_county').text(JSON.parse(localStorage.current_county).name);	//显示当前县名

	//获取当前城市我加入的小区列表
	var data = {
		type:'get_me_area_list',
		city_code:city_info.code,
		db_host:city_info.db_host,
		db_name:city_info.db_name,
		openid:user_info.openid
	}

	Ajax2(data,function(res){
		C(res);
		parse_data(res);
	});

});

function parse_data(res){
	var tmp_str = '';
	if(/^\[.*\]$/.test(res)){
		var obj = JSON.parse(res);
		C(obj);
		for(var i=0;i<obj.length;i++){
			tmp_str += "<div style='display:flex'>";
				tmp_str += "<div style='flex:2' onclick=jump_area_detail("+obj[i][0]+")>" +obj[i][1]+ "<span style='position:absolute;width:5px;height:5px;background:red;border-radius:25px'></span></div>";
				switch(obj[i][2]){
					case '1':case 1:var stat='审核中';break;
					case '2':case 2:var stat='正常';break;
					case '3':case 3:var stat='未通过';break;
				}
				tmp_str += "<div style='flex:1'><span style='font:normal normal 12px/30px normal'>" +stat+ "</span></div>";
			tmp_str += "</div>";
		}
	}

	$('#area_list').html(tmp_str);
}


function jump_area_detail(area_id){
	C(area_id);
	location.href = 'index_areaDetail.html';
}
</script>